/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Classes;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Jaroslav
 */
@Entity
@Table(name = "bug_revision")
@NamedQueries({@NamedQuery(name = "BugRevision.findByRevisionId", query = "SELECT b FROM BugRevision b WHERE b.revisionId = :revisionId"), @NamedQuery(name = "BugRevision.findByBugId", query = "SELECT b FROM BugRevision b WHERE b.bugId = :bugId"), @NamedQuery(name = "BugRevision.findByUserId", query = "SELECT b FROM BugRevision b WHERE b.userId = :userId"), @NamedQuery(name = "BugRevision.findByRevisionTitle", query = "SELECT b FROM BugRevision b WHERE b.revisionTitle = :revisionTitle"), @NamedQuery(name = "BugRevision.findByRevisionKeywords", query = "SELECT b FROM BugRevision b WHERE b.revisionKeywords = :revisionKeywords"), @NamedQuery(name = "BugRevision.findByRevisionUserEmail", query = "SELECT b FROM BugRevision b WHERE b.revisionUserEmail = :revisionUserEmail"), @NamedQuery(name = "BugRevision.findByAddTime", query = "SELECT b FROM BugRevision b WHERE b.addTime = :addTime")})
public class BugRevision implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Column(name = "revision_id", nullable = false)
    private Integer revisionId;
    @Column(name = "bug_id", nullable = false)
    private int bugId;
    @Column(name = "user_id", nullable = false)
    private int userId;
    @Column(name = "revision_title", nullable = false)
    private String revisionTitle;
    @Lob
    @Column(name = "revision_description", nullable = false)
    private String revisionDescription;
    @Column(name = "revision_keywords", nullable = false)
    private String revisionKeywords;
    @Column(name = "revision_user_email", nullable = false)
    private String revisionUserEmail;
    @Column(name = "add_time", nullable = false)
    @Temporal(TemporalType.DATE)
    private Date addTime;

    public BugRevision() {
    }

    public BugRevision(Integer revisionId) {
        this.revisionId = revisionId;
    }

    public BugRevision(Integer revisionId, int bugId, int userId, String revisionTitle, String revisionDescription, String revisionKeywords, String revisionUserEmail, Date addTime) {
        this.revisionId = revisionId;
        this.bugId = bugId;
        this.userId = userId;
        this.revisionTitle = revisionTitle;
        this.revisionDescription = revisionDescription;
        this.revisionKeywords = revisionKeywords;
        this.revisionUserEmail = revisionUserEmail;
        this.addTime = addTime;
    }

    public Integer getRevisionId() {
        return revisionId;
    }

    public void setRevisionId(Integer revisionId) {
        this.revisionId = revisionId;
    }

    public int getBugId() {
        return bugId;
    }

    public void setBugId(int bugId) {
        this.bugId = bugId;
    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public String getRevisionTitle() {
        return revisionTitle;
    }

    public void setRevisionTitle(String revisionTitle) {
        this.revisionTitle = revisionTitle;
    }

    public String getRevisionDescription() {
        return revisionDescription;
    }

    public void setRevisionDescription(String revisionDescription) {
        this.revisionDescription = revisionDescription;
    }

    public String getRevisionKeywords() {
        return revisionKeywords;
    }

    public void setRevisionKeywords(String revisionKeywords) {
        this.revisionKeywords = revisionKeywords;
    }

    public String getRevisionUserEmail() {
        return revisionUserEmail;
    }

    public void setRevisionUserEmail(String revisionUserEmail) {
        this.revisionUserEmail = revisionUserEmail;
    }

    public Date getAddTime() {
        return addTime;
    }

    public void setAddTime(Date addTime) {
        this.addTime = addTime;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (revisionId != null ? revisionId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof BugRevision)) {
            return false;
        }
        BugRevision other = (BugRevision) object;
        if ((this.revisionId == null && other.revisionId != null) || (this.revisionId != null && !this.revisionId.equals(other.revisionId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Classes.BugRevision[revisionId=" + revisionId + "]";
    }

}
